<?php
/**
 * Iterator implementation for iterating over an array.
 * 
 * @package be.appcraft.util
 * @version $Revision: 1.1 $
 * 
 * @author Stijn Van Bael
 * @since 1.0
 *
 */
class Pageley_Util_ArrayIterator implements Iterator {

	/**
	 * The array to iterate over.
	 * 
	 * @var array
	 */
	private $items = array();

	/**
	 * Constructs a new iterator on the specified array.
	 *
	 * @param array $items the array
	 */
    public function __construct($items) {
        $this->items = $items;
    }

    public function rewind() {
        reset($this->items);
    }

    public function current() {
        return current($this->items);
    }

    public function key() {
        return key($this->items);
    }

    public function next() {
        return next($this->items);
    }
    
    public function valid() {
        return $this->current() !== false;
    }
}